// 定义默认state
const defaultState = {
  num: 0,
};
// 定义reducer功能
const reducer = (state = defaultState, action) => {
  switch (action.type) {
    case "increment":
      return {
        ...state,
        num: state.num + 1,
      };
    case "decrement":
      return {
        ...state,
        num: state.num - 1,
      };
    default:
      return state;
  }
};
export default reducer;
